package faction.xuanzhe;

public class Xuanzhe {
    public int[] exe(int[] nums) {

        for (int x = nums.length - 1; x >0; x--) {
            // 记录当前最大值的坐标
            int maxIndex = x;
            for(int y = 0; y <= x; y++) {
                if (nums[y]>nums[maxIndex]) {
                    maxIndex = y;
                }
            }

            // 进行坐标对应值交换
            int temp = nums[x];
            nums[x] = nums[maxIndex];
            nums[maxIndex] = temp;
        }

        return nums;
    }

    public void printXuanzhe(int[] nums) {
        for(int num: nums) {
            System.out.print(num + "\t");
        }
    } 
}
